package com.xinqi.modules.sys.menu.controller.inner;

import com.xinqi.common.base.response.PageInfo;
import com.xinqi.common.base.response.Param;
import com.xinqi.common.base.response.R;
import com.xinqi.modules.sys.menu.dto.req.RoleMenuQueryDTO;
import com.xinqi.modules.sys.menu.dto.rsp.RoleMenuResultDTO;
import com.xinqi.modules.sys.menu.service.RoleMenuService;
import io.swagger.v3.oas.annotations.Hidden;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 系统角色菜单内部控制层
 *
 * @author: linkai
 * @date: 2023/04/01
 */
@Hidden
@RestController
@RequestMapping("/inner/role-menu")
@RequiredArgsConstructor
public class RoleMenuInnerController {
    private final RoleMenuService roleMenuService;

    /**
     * 系统角色菜单-分页
     */
    @GetMapping("/page")
    public R<PageInfo<RoleMenuResultDTO>> page(Param pageable, RoleMenuQueryDTO dto) {
        PageInfo<RoleMenuResultDTO> page = roleMenuService.page(pageable, dto);
        return R.data(page);
    }

    /**
     * 系统角色菜单-详情
     */
    @GetMapping("/{id}")
    public R<RoleMenuResultDTO> findById(@PathVariable("id") Long id) {
        RoleMenuResultDTO dto = roleMenuService.findById(id);
        return R.data(dto);
    }
}
